package com.example3_31rsa.demo;/*
 *@author wujinhui
 *@create ${date} ${time}        
 *@version 1.0.0
 *@码云 小白阿辉
 */


import org.apache.commons.codec.binary.Base64;

import java.security.PrivateKey;
import java.security.PublicKey;
import java.util.Map;

import static com.example3_31rsa.demo.RSA.*;

public class RSAObj {
       private  RSA rsa;
       private PublicKey publicKey;
       private PrivateKey privateKey;
     public RSAObj(){
         this.rsa=new RSA();
         Map<String, byte[]> keyMap = generateKeyBytes();
        this.publicKey = restorePublicKey(keyMap.get(PUBLIC_KEY));
        this.privateKey = restorePrivateKey(keyMap.get(PRIVATE_KEY));

     }

    public RSA getRsa() {
        return rsa;
    }

    public void setRsa(RSA rsa) {
        this.rsa = rsa;
    }

    public PublicKey getPublicKey() {
        return publicKey;
    }

    public void setPublicKey(PublicKey publicKey) {
        this.publicKey = publicKey;
    }

    public PrivateKey getPrivateKey() {
        return privateKey;
    }

    public void setPrivateKey(PrivateKey privateKey) {
        this.privateKey = privateKey;
    }
}
